1. Field of the Invention
The present invention relates to a technique, system and computer program for utilizing a single database query to query multiple databases to which a user or application has access to find and retrieve desired data. More particularly, the present invention relates to a technique for creating a single query from a user""s software program or application which is compatible with all of the databases accessible from the application that will query all such databases for data designated in the query from only a single sending of the query.
2. Description of the Related Art
Networks of linked computers are becoming more and more common. Computers linked via a network often do not have the same software programs or applications or operating systems loaded and operating thereon, or they may have different versions of the same software application or operating system. Communication is often limited between different versions of the same software application, and it is typically more difficult between different applications altogether. Thus, attempts to communicate and exchange information from one computer to another, or even between different applications loaded on the same computer, can be very difficult due to incompatibility.
One common usage of networks today is to access information or data. Information is typically maintained in storage, on devices such as hard drives, tape drives, and the like, and is managed by database management software which controls access to and the modification of the data under its control. Examples of database software include DB2 from the International Business Machines Corporation (IBM), Oracle7 from Oracle Corporation and Informix-Universal Server from Informix Software, Inc. (DB2 is a registered trademark of IBM, Oracle and Oracle7 are trademarks of the Oracle Corporation, and Informix is a trademark of Informix Software, Inc.). Quite often, when a user of a software application needs data, the user""s application will contact or query a database to find and retrieve the desired information for use in the application. If the specific database in which the data is stored is known, finding and retrieving the data is a relatively simple procedure. A database query in the appropriate format for the target database is created and sent to the target database. However, for situations in which the particular database in which the data is maintained is unknown, and the user has access to multiple databases and the databases are from different vendors and/or the databases are incompatible, the task of obtaining the desired information can become quite arduous. Under presently available techniques, a database query, such as an SQL query (which is a query format which operates with SQL-enabled databases), must be sent separately to each possible database in which the desired information may be stored. Each SQL statement needs to be addressed separately and specifically for each database, which can be a time consuming task.
Accordingly, a need exists for a technique by which a single database query can be invoked which queries multiple non-homogenous databases.
An object of the present invention is to provide a technique by which a single database query may be employed to query multiple non-homogeneous databases.
Another object of the present invention is to provide a database access technique which does not require the requesting user or application to know precise details regarding the location of the database which is being queried.
Yet another object of the invention is to provide a technique for querying multiple databases which is transparent to the user or application which initiated the query.
Other objects and advantages of the present invention will be set forth in part in the description and the drawings which follow, and, in part, will be obvious from the description or may be learned by practice of the invention.
To achieve the foregoing objects, and in accordance with the purpose of the invention as broadly described herein, the present invention provides a software implemented process for use in a computing environment having a plurality of non-homogeneous databases accessible through associated servers, comprising first subprocesses for generating, at a requesting entity, a single database query requesting desired data; second subprocesses for sending the single database query over a network; third subprocesses for permitting at least some of the servers to receive the single database query; fourth subprocesses for determining, for each combination of the databases and the associated servers which received the single database query, whether the database contains the desired data; and, for the database found to contain the desired data, if any, fifth subprocesses for retrieving the desired data from the database and sending the desired data as required by the requesting entity. The requesting entity may be a client in a client/server environment, and the fifth subprocesses may further send the desired data to the client. Preferably, the request generated by the first subprocesses is an SQL query which includes the names of a target database and a table in the target database containing the desired data, but is not in a syntax required by the target database, and wherein the fifth subprocesses further generates a query for the target database in the proper syntactic form for the target database. The network preferably utilizes client/server TCP/IP socket communications, wherein the second subprocesses further comprises sending the single database query over a predefined socket port, and wherein the servers which receive the single database query in the third subprocesses are listening to the predefined socket port over the network. Further, each of the servers may be associated with a factory class which receives the single database query and determines in the fourth subprocesses whether the desired data resides in the database associated with the server with which the factory class is associated.
Additionally, the present invention provides a system for accessing data in a computer environment comprising non-homogeneous databases utilizing a database query sent once from a client which is seeking data, comprising a plurality of servers connected via a network; a plurality of databases, each of the databases associated with one of the servers, wherein at least one of the databases utilizes a query format which is different from other query formats for the databases; means associated with a client for generating a first database query requesting desired data and sending the first database query to the servers via the network; means associated with each of the servers for determining if the database associated with the server includes the desired data, and if so, preparing a second database query in a form acceptable to the associated database having the desired data which requests the desired data; and means for sending the desired data from the database having the desired data to the client. Further, the determining means may further comprise preparing and sending a response to the client if it determines that the associated database does not contain the desired data, the response informing the client that the database does not contain the desired data. Additionally, the client may construct a record relative to the first database query in which the response from each of the databases is logged. The determining means may further comprise a factory class which determines whether the associated database includes the desired data. The network may utilize client/server TCP/IP socket communications, and the client may send the first database query over the network via a predefined Java socket port, and the servers which receive the first database query are preferably programmed to listen to the predefined Java socket port.
The present invention will now be described with reference to the following drawings, in which like reference numbers denote the same element throughout.